home *** CD-ROM | disk | FTP | other *** search
/ MACD 5 / MACD 5.bin / workbench / tools / czesc_1 / easyprocess / source / launch / isparent.c < prev    next >
C/C++ Source or Header  |  1992-09-07  |  1KB  |  55 lines

  1. #include <arpbase.h>
  2. #include <arp_proto.h>
  3. #include "Launch.h"
  4. #include "LaunchPriv.h"
  5.  
  6.  
  7. /*
  8.  *    NAME
  9.  *        IsParent -- verifies if the process is a parent to another one.
  10.  *
  11.  *    SYNOPSIS
  12.  *        pp = IsParent (Proc)
  13.  *
  14.  *        struct ProcPair *IsParent (struct Process *);
  15.  *
  16.  *    FUNCTION
  17.  *        Check if the process has started a child process and if the
  18.  *        child is still active.
  19.  *
  20.  *    DESCRIPTION
  21.  *        Scan the process pair linked list for a pair which is has the
  22.  *        input process as the parent.  If it find one, return a pointer
  23.  *        to it.
  24.  *
  25.  *    INPUT
  26.  *        Proc - a pointer to the process to be checked.
  27.  *
  28.  *    OUTPUT
  29.  *        pp - a ProcPair structure pointer.
  30.  *
  31.  *    NOTE
  32.  *        Assume Forbid() has been called to make sure the list is not
  33.  *        modified while we scan it.
  34.  *
  35.  *    HISTORY
  36.  *        1992/09/06    Pierre Baillargeon        Creation
  37.  *
  38.  *    SEE ALSO
  39.  *        IsChild()
  40.  */
  41.  
  42. struct ProcPair *IsParent (struct Process *Proc)
  43. {
  44.     struct ProcPair *pp;
  45.     if (NULL != ProcPairList)
  46.     {
  47.         for (pp = (struct ProcPair *)ProcPairList->lh_Head; pp->pp_Node.ln_Succ; pp = (struct ProcPair *)pp->pp_Node.ln_Succ)
  48.         {
  49.             if (Proc == pp->pp_Parent)
  50.                 return pp;
  51.         }
  52.     }
  53.     return NULL;
  54. }
  55.